using System.Data;
using Lamex.Base.Framework.BaseAbs; 
using Lamex.Base.Framework.BaseDal; 
using  Lamex.SIESystemManager.Interface; 
using  Lamex.SIESystemManager.Model; 
namespace Lamex.SIESystemManager.DalServer 
{
 public class B_IE_BOMImport : BaseDalSQL<B_IE_BOMImportInfo>,IB_IE_BOMImport
  {
        public int IsExistDrawRecord(string BOMNum)
        {
            int m = 0;
            string sql = "select top 1 * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num='" + BOMNum + "'";
            if (base.GetDataTableBySql(sql).Rows.Count > 0) m = 1;
            return m;
        }
        //Stander
        public DataTable NotFinish(string DrawNum)
        {
            int m = 0;
            string sql = "select * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num collate Chinese_PRC_CI_AS not in  (select DRAWING_NUMBER from B_IE_Operation_Data) ";
            return base.GetDataTableBySql(sql);
        }
        public DataTable HasFinish(string DrawNum)
        {
            int m = 0;
            string sql = "select * from [Edgeband_Program].dbo.Initial_Data where Drawing_Num collate Chinese_PRC_CI_AS  in  (select DRAWING_NUMBER from B_IE_Operation_Data) ";
            return base.GetDataTableBySql(sql);
        }

        //BOMDATASET
        public DataSet BOMDataSet()
        {
            int m = 0;
            string sql = @"select * from B_IE_BOMImport where Flag!=1   order by CREATE_TIME  desc;
                           select * from B_IE_BOMImport where BOMNum collate Chinese_PRC_CI_AS not in  (select DRAWING_NUMBER from B_IE_Operation_Data)  order by CREATE_TIME desc;
                           select * from B_IE_BOMImport where BOMNum collate Chinese_PRC_CI_AS  in  (select DRAWING_NUMBER from B_IE_Operation_Data)  order by CREATE_TIME desc ";
            return base.GetDataSetBySql(sql);
        }

        public int ImportBOMRecord(string BOMNum)
        {
            int m = 0;
            string sql = "select top 1 * from B_IE_BOMImport where BOMNum='" + BOMNum + "'";
            if (base.GetDataTableBySql(sql).Rows.Count > 0) m = 1;
            return m;
        }
       
    }
}
